package cn.mw.cmdb.template.entity.export;

import cn.mw.cmdb.template.constant.MwTemplateConfigurationConstant;
import cn.mw.cmdb.template.entity.convert.InterfaceConvertDto;
import cn.mw.cmdb.template.entity.convert.MwTemplateConvertOne;
import cn.mw.cmdb.template.enums.TriggerFunctionsDto;
import com.alibaba.excel.annotation.ExcelProperty;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Getter;
import lombok.Setter;
import org.apache.commons.lang3.StringUtils;

import java.util.List;

/**
 * @author gengjb
 * @description 主机导出实体
 * @date 2024/9/3 15:52
 */
@Getter
@Setter
@Schema(name = "HostExportDto", description = "主机导出实体")
public class HostExportDto {
    private String hostid;

    @ExcelProperty(value = {"主机名称"})
    private String host;

    @ExcelProperty(value = {"主机可见名称"})
    private String name;

    @ExcelProperty(value = {"主机描述"})
    private String description;

    @ExcelProperty(value = {"主机状态"})
    private String status;

    private List<InterfaceConvertDto> interfaces;

    private List<MwTemplateConvertOne> parentTemplates;

    public void setStatus(String status) {
        if(StringUtils.isNotEmpty(status) && Integer.parseInt(status) == 0){
            this.status = MwTemplateConfigurationConstant.ENABLED;
            return;
        }
        if(StringUtils.isNotEmpty(status) && Integer.parseInt(status) == 1){
            this.status = MwTemplateConfigurationConstant.NOT_ENABLED;
            return;
        }
        this.status = status;
    }
}
